package com.foreknow.demo12;

/**
 * 方法的重载(Overload)
 * 规则：
 * 1.方法的名称一琮要相同
 * 2.参数列表一定不同并且参数类型的顺序不同
 * 3.与返回值类型无关
 *
 */
public class OverloadDemo {

  public int add(int a,int b){
    return a+b;
  }

  public void add(int a,int b,int c){
    System.out.println(a+b+c);
  }

  public static void main(String[] args) {
    OverloadDemo overloadDemo = new OverloadDemo();
    int sum = overloadDemo.add(1,2);
    System.out.println(sum);

    overloadDemo.add(1,2,3);

  }
}
